home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
gui
/
app
/
eventStack.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
4KB
|
128 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import sys
import os
import wx
class AppEventManager:
ui_events = [
wx.ID_NEW,
wx.ID_OPEN,
wx.ID_CLOSE_ALL,
wx.ID_CLOSE,
wx.ID_REVERT,
wx.ID_SAVE,
wx.ID_SAVEAS,
wx.ID_UNDO,
wx.ID_REDO,
wx.ID_PRINT,
wx.ID_PRINT_SETUP,
wx.ID_PREVIEW,
wx.ID_EXIT]
def __init__(self):
pass
def RegisterEvents(self):
app = wx.GetApp()
for eventID in self.ui_events:
app.AddHandlerForID(eventID, self.ProcessEvent)
app.AddUIHandlerForID(eventID, self.ProcessUpdateUIEvent)
class AppEventHandlerMixin:
def __init__(self):
self.handlers = { }
self.uihandlers = { }
self.pushed_handlers = { }
self.pushed_uihandlers = { }
def AddHandlerForIDs(self, eventID_list, handlerFunc):
for eventID in eventID_list:
self.AddHandlerForID(eventID, handlerFunc)
def AddHandlerForID(self, eventID, handlerFunc):
self.Bind(wx.EVT_MENU, self.HandleEvent, id = eventID)
if eventID in self.handlers:
self.pushed_handlers[eventID] = self.handlers[eventID]
self.handlers[eventID] = handlerFunc
def AddUIHandlerForID(self, eventID, handlerFunc):
self.Bind(wx.EVT_UPDATE_UI, self.HandleUpdateUIEvent, id = eventID)
if eventID in self.uihandlers:
self.pushed_uihandlers[eventID] = self.uihandlers[eventID]
self.uihandlers[eventID] = handlerFunc
def RemoveHandlerForIDs(self, eventID_list):
for eventID in eventID_list:
self.RemoveHandlerForID(eventID)
def RemoveHandlerForID(self, eventID):
self.Unbind(wx.EVT_MENU, id = eventID)
self.handlers[eventID] = None
if eventID in self.pushed_handlers:
self.handlers[eventID] = self.pushed_handlers[eventID]
def RemoveUIHandlerForID(self, eventID):
self.Unbind(wx.EVT_UPDATE_UI, id = eventID)
self.uihandlers[eventID] = None
if eventID in self.pushed_uihandlers:
self.uihandlers[eventID] = self.pushed_uihandlers[eventID]
def HandleEvent(self, event):
e_id = event.GetId()
if e_id in self.handlers:
handler = self.handlers[e_id]
try:
if handler:
return handler(event)
except wx.PyDeadObjectError:
self.RemoveHandlerForID(e_id)
except:
None<EXCEPTION MATCH>wx.PyDeadObjectError
None<EXCEPTION MATCH>wx.PyDeadObjectError
event.Skip()
return False
def HandleUpdateUIEvent(self, event):
e_id = event.GetId()
if e_id in self.uihandlers:
handler = self.uihandlers[e_id]
try:
if handler:
return handler(event)
except wx.PyDeadObjectError:
self.RemoveUIHandlerForID(e_id)
except:
None<EXCEPTION MATCH>wx.PyDeadObjectError
None<EXCEPTION MATCH>wx.PyDeadObjectError
event.Skip()
return False